{% extends 'base.html' %}
{% block title %}借阅历史 - Local Library{% endblock %}
{% block content %}
    <h1>我的借阅历史</h1>
    {% if bookinstance_list %}
        <table>
            <tr>
                <th>书名</th>
                <th>作者</th>
                <th>借阅日期</th>
                <th>到期日</th>
                <th>状态</th>
            </tr>
            {% for inst in bookinstance_list %}
            <tr>
                <td><a href="{% url 'book-detail' inst.book.pk %}">{{ inst.book.title }}</a></td>
                <td>{{ inst.book.author }}</td>
                <td>{{ inst.imprint }}</td>
                <td>{{ inst.due_back }}</td>
                <td>
                    {% if inst.status == 'a' %}已归还{% elif inst.status == 'o' %}借阅中{% elif inst.status == 'm' %}维护中{% elif inst.status == 'r' %}已预订{% endif %}
                </td>
            </tr>
            {% endfor %}
        </table>
        {% if is_paginated %}
            <div class="pagination">
                {% if page_obj.has_previous %}
                    <a href="?page={{ page_obj.previous_page_number }}">上一页</a>
                {% endif %}
                <span>第 {{ page_obj.number }} 页，共 {{ page_obj.paginator.num_pages }} 页</span>
                {% if page_obj.has_next %}
                    <a href="?page={{ page_obj.next_page_number }}">下一页</a>
                {% endif %}
            </div>
        {% endif %}
    {% else %}
        <p>暂无借阅历史。</p>
    {% endif %}
{% endblock %} 